#include "stdafx.h"
#include "detail/bmock_out_raw_mem_ptr.hpp"

namespace bmock {
	out_raw_mem_ptr::out_raw_mem_ptr(const char *const n,const void *const exp,const raw_mem &tar)
		:out_arg_val(n)
		,rm_exp_(exp)
		,rm_target_(tar)
	{}

	out_raw_mem_ptr::~out_raw_mem_ptr() {
	}

	std::string out_raw_mem_ptr::get_out_value(const arg_checker &chk) const {
		in_out_rm_pair rmp(rm_exp_,name_,chk);
		return rmp.second.get_value();
	}

	bool out_raw_mem_ptr::update_out_value(const arg_checker &chk,const std::string &v) const {
		return rm_target_.set_value(name_,chk,v);
	}

	void out_raw_mem_ptr::update(const std::string &v,const control_tools_ptr& t,int ) const {
		bmock::location loc_;
		t->check_less_or_equal(v.length()/2,rm_target_.get_length(),message(RAW_MEM_LEN_CONSOLE,name_),loc_);
		rm_target_.set_value(v.length()/2,v);
	}

	bool out_raw_mem_ptr::null_supplied() const {
		return (NULL==rm_target_.get_ptr());
	}
}